#ifndef __KEYVALUE_H__
#define __KEYVALUE_H__


#include "string.h"
#include <stdio.h>
#include <stdlib.h>
#include "fatfs.h"

typedef enum 
{
    eDICT_ERR_OK = 0x00,
    eDICT_ERR_PARA_INVALID, //参数无效
    eDICT_ERR_KEY_IS_EXSIT, //键值存在不能在添加
    eDICT_ERR_KEY_NOT_FOUND, //键值不存在
    eDICT_ERR_MEM_NOT_ENOUGH, //内存不够
} eDICT_ERR;
typedef struct _KeyValueLine* KeyValueLinePtr; 
typedef struct _KeyValueLine KeyValueLine;
typedef struct _Dict
{
    KeyValueLinePtr head; //头指针
    uint32_t size; //字典中键值对的数量
}Dict;

#define MAX_KEY_LENGTH 32
#define MAX_VALUE_LENGTH 32

eDICT_ERR Dict_Init(Dict * dict);
eDICT_ERR Dict_Create(Dict * dict, const char * key, const char * value);
eDICT_ERR Dict_Del(Dict * dict, const char * key);
eDICT_ERR Dict_GetValue(Dict * dict, char* key, char* value);
eDICT_ERR Dict_SetValue(Dict * dict, char* key, char* value);
eDICT_ERR Dict_Dumps(Dict * dict, char* str);
eDICT_ERR Dict_Loads(Dict * dict,char* str);
eDICT_ERR Dict_Clears(Dict * dict);




#endif
